package com.turing.post.salesmanage.util;

import javax.ejb.ApplicationException;

import com.turing.post.util.*;

@SuppressWarnings("serial")
@ApplicationException(rollback = true)
public class SalesManageApplicationException extends PCPSApplicationException {

	/**
	 * 返回子系统名称
	 */
	public String getSubSysName() {
		return PCPSTSubSys.SUBSYS_SALES;
	}

	/**
	 * 返回子系统错误码简洁描述
	 * 
	 * @return
	 */
	public String getSubSysSysErrCodeDesc() {
		return SalesManageRespCode.getRespCodeMessage(getSubSysErrCode());
	}

	/**
	 * PCIFApplicationException 异常
	 * 
	 * @param errcode_category
	 *            主错误码
	 * @param subsys_errcode
	 *            子系统错误码
	 * @param errmsg
	 *            错误信息
	 */
	public SalesManageApplicationException(String errcode_category,
			String subsys_errcode, String errmsg) {
		super(errcode_category, subsys_errcode, errmsg);
	}

	/**
	 * PCIFApplicationException 应用异常
	 * 
	 * @param subsys_errcode
	 *            主错误码
	 * @param errmsg
	 *            错误信息
	 */
	public SalesManageApplicationException(String subsys_errcode, String errmsg) {
		super(ERRCODE_CATEGORY_APPLICATION, subsys_errcode, errmsg);
	}

	/**
	 * PCIFApplicationException 应用异常
	 * 
	 * @param subsys_errcode
	 *            错误信息
	 */
	public SalesManageApplicationException(String subsys_errcode) {
		super(ERRCODE_CATEGORY_APPLICATION, subsys_errcode, ERRMSG_UNKNOWN);
	}

	public static void DatabaseException(String ErrMsg)
			throws SalesManageApplicationException {
		throw new SalesManageApplicationException(
				PCPSApplicationException.ERRCODE_CATEGORY_DATABASE, "", ErrMsg);
	}
}
